package com.aitaoxue.palx.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ScrollView;

public class FadingScrollView extends ScrollView {

	private static final String TAG = FadingScrollView.class.getSimpleName();

	private OnScrollListener listener;

	public FadingScrollView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public FadingScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public FadingScrollView(Context context) {
		super(context);
	}

	@Override
	protected void onScrollChanged(int l, int t, int oldl, int oldt) {
		Log.d(TAG, t+"");
		listener.onScroll(t);
	}

	public interface OnScrollListener {
		void onScroll(int distance);
	}

	public void setScrollListener(OnScrollListener listener) {
		this.listener = listener;
	}

}
